<template lang="html">
  <div class="box">
    <header-title :HeaderTitle='title'></header-title>
    <address-list :listmain="addresslist"></address-list>
    <router-link class="goPay" to="/gerenaddressadd">+新增地址</router-link>
  </div>
</template>
<script type>
import title from "../header/header.vue";
import AddressList from "./addresslist.vue";
export default {
  name: 'geren',
  data () {
    return {
      title:{
        url:'/gerenaccount',
        title:"收货地址"
      },
      addresslist:[]
    }
  },
  created:function() {
    let _url = "/index.php?g=app&m=shopping&a=address_list_post",
    cur_id = window.sessionStorage.getItem("cur_id"),
    sign = window.sessionStorage.getItem("sign"),
    conent = this,
    _data = {
      cur_id:cur_id,
      sign:sign
    };
    conent.$http.post(_url,_data).then(function(data){
      if(data.data.status== "1"){
        conent.addresslist =data.data.data.address_list;
      }else {
        conent.$toast("还没有收货地址");
      }
    },function(response){
        conent.$toast(response.data);
    })
  },
  components:{
    'header-title':title,
    'address-list':AddressList
  }
}
</script>

<style scoped lang="less">
@import '../../../assets/less/index.less';
.box {
  .goPay{
    width: 100vw;
    line-height: 13.3vw;
    height: 13.3vw;
    color: @color1;
    background-color: @color;
    position: fixed;
    bottom: 0;
    left: 0;
  }
}
</style>